package com.itlong.cloud.sdk.resource;

import com.itlong.cloud.POJO.PO.BuildInfoPO;
import com.itlong.cloud.project.sdk.ISDKServerOldBuildServiceClient;
import com.itlong.cloud.sdk.service.ISDKServerOldBuildService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      SDK楼栋服务层暴露接口实现类
 * </desc>
 *
 * @createDate 2017/11/8
 */
@RestController
public class SDKServerOldBuildServiceResource implements ISDKServerOldBuildServiceClient {

    @Autowired
    ISDKServerOldBuildService iSDKBuildService;

    /**
     * <desc>
     *      根据参数字段查询build_info信息
     * <desc/>
     * @param  param  查询参数集
     * @return List<BuildInfoPO>    返回对象集
     * @author Biao.R
     * @createDate 2017/11/8
     */
    @Override
    @PostMapping(path = "sdkServer/build/getBuildByParam")
    public List<BuildInfoPO> getBuildByParam(@RequestBody Map<String, Object> param) {
        return iSDKBuildService.getBuildByParam(param);
    }

    /**
     * <desc>
     *      更新楼栋信息
     * <desc/>
     * @param   buildPO    待更新的PO对象
     * @return  Integer     更新数量
     * @author Biao.R
     * @createDate 2017/11/8
     */
    @PostMapping(path = "sdkServer/build/update")
    @Override
    public Integer update(@RequestBody BuildInfoPO buildPO) {
        return iSDKBuildService.update(buildPO);
    }

    /**
     * <desc>
     *      保存楼栋信息
     * <desc/>
     * @param   buildPO    待保存的PO对象
     * @return  Integer     保存数量
     * @author Biao.R
     * @createDate 2017/11/8
     */
    @PostMapping(path = "sdkServer/build/save")
    @Override
    public Integer save(@RequestBody BuildInfoPO buildPO) {
        return iSDKBuildService.save(buildPO);
    }

    /**
     * <desc>
     *      根据楼栋编号查询楼栋ID
     * <desc/>
     * @param  params   查询参数集
     * @return  楼栋ID拼接成的字符串
     * @author Biao.R
     * @createDate 2017/11/14
     */
    @PostMapping(path = "sdkServer/build/getBuildIdsByParams")
    @Override
    public String getBuildIdsByParams(@RequestBody Map<String, String> params) {
        return iSDKBuildService.getBuildIdsByParams(params);
    }
}